#!/usr/bin/env python
import sys
sys.path.append("../python")
import edbcli

import time
import random

if __name__ == "__main__":


	
	# test various malformed net shell handling:
	
#	def query(self, preamble_query, items = None ):


	edb = edbcli.Client(["127.0.0.1:11911"])
	c = 1
#	c = 10
	for i in range(c):
		ql = []
		for j in range(1000):
			x = i * j
			y = "".join( [random.choice('abcdefghij') for q in range(20)] )
			z = x*x
			ql.append( { "domain":	"domain_"+random.choice('123456789'), "x": x, "y":y, "z":z, "time": time.ctime() } )
		
		r = edb.query( "INSERT INTO $domain VALUES( _name:$x, y:$y, z:$z, time:$time);", ql)
	
	sys.exit(0)
	# this is the non-chunked version:
	
	edb = edbcli.Client(["127.0.0.1:11911"])
#	c = 1000
	c = 10
	for x in range(c):
		y = "".join( [random.choice('abcdefghij') for q in range(20)] )
		z = x*x
		d = { "domain":	"domain_"+random.choice('123456789'), "x": x, "y":y, "z":z, "time": time.ctime() }
		
		r = edb.query( "INSERT INTO $domain VALUES( _name:$x, y:$y, z:$z, time:$time);", [d] )	
	
	# test_domain
	# another_domain
	# yet_another_domain
	# domain4
